<?xml version="1.0" encoding="UTF-8" ?>

<!-- 
One XLST that use HTML + CSS to display a table with all the stadiums showing 
for each stadium the number of games which took place there with the total 
number of spectators.
-->

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="xml" indent="yes"/>
	
	<xsl:template match="/">
		<xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="xslt/jornada_data_CONF_BF.xslt"</xsl:processing-instruction>
	
	<betfairmakets>
	<xsl:variable name="tn"/>
		<xsl:for-each select="/TEAMS/TEAM">

			<xsl:variable name="teamNameBF" select="BF"/>
			<team_bf><xsl:value-of select="$teamNameBF"/></team_bf>
	
			<xsl:variable name="events" select="document('../BF.xml')/betfair/event[contains(@name, $teamNameBF)]"/>
			
			
				
			<xsl:for-each select="$events">
				<event>		
					<name><xsl:value-of select="@name"/></name>
						<xsl:for-each select="$events/subevent[@title='Match Odds']">
							<market>
								<title><xsl:value-of select="@title"/></title>
								<xsl:for-each select="selection">
									<selection>
										<xsl:value-of select="concat(@name, ' ', @backp1, ' ', @layp1)"/>					
									</selection>
								</xsl:for-each>
							</market>		
						</xsl:for-each>		
				</event>
			</xsl:for-each>
		</xsl:for-each>


	</betfairmakets>

	</xsl:template>

</xsl:stylesheet>
